package com.bw.configer;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.bw.mapper.MavenMapper;
import com.bw.service.MavenService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class MavenConfig {
    @Autowired
    MavenService mavenService;

    @RequestMapping("/findXian")
    public Object findXian(String time){
        List<Map> list = mavenService.findXian("2021-04-23");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("status",0);
        jsonObject.put("msg","");

        JSONArray array = new JSONArray();
        for (Map map : list) {
            JSONObject MapObject = new JSONObject();
            MapObject.put("categories","create_time");
            MapObject.put("series","name");

            array.add(MapObject);
        }
        jsonObject.put("data","dataTime");
        return jsonObject;
    }

    @RequestMapping("/findBing")
    public Object findBing(String date){
        List<Map> list = mavenService.findBing("2021-04-23");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("status",0);
        jsonObject.put("msg","");

        JSONArray array = new JSONArray();
        for (Map map : list) {
            JSONObject MapObject = new JSONObject();
            MapObject.put("categories","create_time");
            MapObject.put("series","name");

            array.add(MapObject);
        }
        jsonObject.put("data","dataTime");
        return 111;
    }

    @RequestMapping("/findLun")
    public Object findLun(String add){
        return 111;
    }

    @RequestMapping("/findZhu")
    public Object findZhu(String bbq){
        return 111;
    }
}
